Take the property id instead of the name.
{
GtkBorder *width;
- image->source = _gtk_css_image_value_get_image (_gtk_theming_engine_peek_property (engine, "border-image-source"));
+ image->source = _gtk_css_image_value_get_image (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE));
if (image->source == NULL)
return FALSE;
- image->slice = *(GtkBorder *) _gtk_css_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-slice"));
- width = _gtk_css_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-width"));
+ image->slice = *(GtkBorder *) _gtk_css_value_get_boxed (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE));
+ width = _gtk_css_value_get_boxed (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH));
if (width)
{
image->width = *width;
else
image->has_width = FALSE;
- image->repeat = *_gtk_css_value_get_border_image_repeat (_gtk_theming_engine_peek_property (engine, "border-image-repeat"));
+ image->repeat = *_gtk_css_value_get_border_image_repeat (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT));
return TRUE;
}
{
GtkCssValue *parent_value;
/* Set NULL here and do the inheritance upon lookup? */
- parent_value = _gtk_style_context_peek_property (parent,
- _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop)));
+ parent_value = _gtk_style_context_peek_property (parent, id);
g_ptr_array_index (values->values, id) = _gtk_css_value_ref (parent_value);
}
break;
case GTK_CSS_EM:
return _gtk_css_number_value_new (number->value *
- _gtk_css_number_value_get (_gtk_style_context_peek_property (context, "font-size"), 100),
+ _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
return _gtk_css_number_value_new (number->value * 0.5 *
- _gtk_css_number_value_get (_gtk_style_context_peek_property (context, "font-size"), 100),
+ _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
GtkStyleContext *parent = gtk_style_context_get_parent (context);
if (parent)
- return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, "color"));
+ return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, GTK_CSS_PROPERTY_COLOR));
else
return _gtk_css_rgba_value_compute_from_symbolic (fallback, NULL, context, TRUE);
}
else
{
- return _gtk_css_value_ref (_gtk_style_context_peek_property (context, "color"));
+ return _gtk_css_value_ref (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
}
}
GdkRGBA rgba;
if (symbolic == _gtk_symbolic_color_get_current_color ())
- rgba = *_gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, "color"));
+ rgba = *_gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
else if (!gtk_symbolic_color_resolve (symbolic, NULL, &rgba))
rgba = white;
GtkStyleContext *context,
GtkCssValue *specified)
{
- GtkCssStyleProperty *style;
GtkBorderStyle border_style;
/* The -1 is magic that is only true because we register the style
* properties directly after the width properties.
*/
- style = _gtk_css_style_property_lookup_by_id (_gtk_css_style_property_get_id (property) - 1);
-
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (style))));
+ border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, _gtk_css_style_property_get_id (property) - 1));
if (border_style == GTK_BORDER_STYLE_NONE ||
border_style == GTK_BORDER_STYLE_HIDDEN)
dest->unit = GTK_CSS_PX;
break;
case GTK_CSS_EM:
- dest->value = src->value * _gtk_css_number_value_get (_gtk_style_context_peek_property (context, "font-size"), 100);
+ dest->value = src->value * _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100);
dest->unit = GTK_CSS_PX;
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
- dest->value = src->value * _gtk_css_number_value_get (_gtk_style_context_peek_property (context, "font-size"), 100);
+ dest->value = src->value * _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100);
dest->unit = GTK_CSS_PX;
break;
case GTK_CSS_RAD:
GtkCssValue *
_gtk_style_context_peek_property (GtkStyleContext *context,
- const char *property_name)
+ guint property_id)
{
StyleData *data = style_data_lookup (context);
- return _gtk_css_computed_values_get_value_by_name (data->store, property_name);
+ return _gtk_css_computed_values_get_value (data->store, property_id);
}
double
_gtk_style_context_get_number (GtkStyleContext *context,
- const char *property_name,
+ guint property_id,
double one_hundred_percent)
{
GtkCssValue *value;
- value = _gtk_style_context_peek_property (context, property_name);
+ value = _gtk_style_context_peek_property (context, property_id);
return _gtk_css_number_value_get (value, one_hundred_percent);
}
void _gtk_style_context_set_widget (GtkStyleContext *context,
GtkWidget *widget);
GtkCssValue * _gtk_style_context_peek_property (GtkStyleContext *context,
- const char *property_name);
+ guint property_id);
double _gtk_style_context_get_number (GtkStyleContext *context,
- const char *property_name,
+ guint property_id,
double one_hundred_percent);
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
GType widget_type,
GtkCssArea origin;
cairo_rectangle_t image_rect;
- origin = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, "background-clip"));
+ origin = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP));
/* The default size of the background image depends on the
background-origin value as this affects the top left
static void
_gtk_theming_background_apply_clip (GtkThemingBackground *bg)
{
- GtkCssArea clip = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, "background-clip"));
+ GtkCssArea clip = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP));
if (clip == GTK_CSS_AREA_PADDING_BOX)
{
double image_width, image_height;
double width, height;
- size = _gtk_css_value_get_background_size (_gtk_style_context_peek_property (bg->context, "background-size"));
- pos = _gtk_css_value_get_background_position (_gtk_style_context_peek_property (bg->context, "background-position"));
+ size = _gtk_css_value_get_background_size (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_SIZE));
+ pos = _gtk_css_value_get_background_position (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_POSITION));
gtk_style_context_get (bg->context, bg->flags,
"background-repeat", &hrepeat,
NULL);
_gtk_theming_background_apply_shadow (GtkThemingBackground *bg,
cairo_t *cr)
{
- _gtk_css_shadow_value_paint_box (_gtk_style_context_peek_property (bg->context, "box-shadow"),
+ _gtk_css_shadow_value_paint_box (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BOX_SHADOW),
cr,
&bg->padding_box);
}
_gtk_theming_background_apply_clip (bg);
_gtk_theming_background_apply_origin (bg);
- bg->image = _gtk_css_image_value_get_image (_gtk_style_context_peek_property (bg->context, "background-image"));
+ bg->image = _gtk_css_image_value_get_image (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_IMAGE));
}
void
GtkCssValue *
_gtk_theming_engine_peek_property (GtkThemingEngine *engine,
- const char *property_name)
+ guint property_id)
{
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), NULL);
- g_return_val_if_fail (property_name != NULL, NULL);
- return _gtk_style_context_peek_property (engine->priv->context, property_name);
+ return _gtk_style_context_peek_property (engine->priv->context, property_id);
}
double
_gtk_theming_engine_get_number (GtkThemingEngine *engine,
- const char *property_name,
+ guint property_id,
double one_hundred_percent)
{
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0.0);
- g_return_val_if_fail (property_name != NULL, 0.0);
- return _gtk_style_context_get_number (engine->priv->context, property_name, one_hundred_percent);
+ return _gtk_style_context_get_number (engine->priv->context, property_id, one_hundred_percent);
}
/**
render_border (cr, &border_box, &border, hidden_side, colors, border_style);
}
- border_style[0] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, "outline-style"));
+ border_style[0] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_STYLE));
if (border_style[0] != GTK_BORDER_STYLE_NONE)
{
int offset;
border_style[1] = border_style[2] = border_style[3] = border_style[0];
- border.top = _gtk_css_value_get_int (_gtk_theming_engine_peek_property (engine, "outline-width"));
+ border.top = _gtk_css_value_get_int (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_WIDTH));
border.left = border.right = border.bottom = border.top;
- colors[0] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, "outline-color"));
+ colors[0] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_COLOR));
colors[3] = colors[2] = colors[1] = colors[0];
- offset = _gtk_css_value_get_int (_gtk_theming_engine_peek_property (engine, "outline-offset"));
+ offset = _gtk_css_value_get_int (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_OFFSET));
/* reinit box here - outlines don't have a border radius */
_gtk_rounded_box_init_rect (&border_box, x, y, width, height);
fg_color.alpha = CLAMP (fg_color.alpha + ((other_fg.alpha - fg_color.alpha) * progress), 0, 1);
}
- text_shadow = _gtk_theming_engine_peek_property (engine, "text-shadow");
+ text_shadow = _gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_TEXT_SHADOW);
prepare_context_for_layout (cr, x, y, layout);
radius = MIN (width / 2, height / 2);
gtk_theming_engine_get_color (engine, state, &color);
- shadow = _gtk_theming_engine_peek_property (engine, "icon-shadow");
+ shadow = _gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SHADOW);
cairo_save (cr);
cairo_translate (cr, x + width / 2, y + height / 2);
gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
- _gtk_css_shadow_value_paint_icon (_gtk_theming_engine_peek_property (engine, "icon-shadow"), cr);
+ _gtk_css_shadow_value_paint_icon (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SHADOW), cr);
cairo_paint (cr);
GdkRGBA *color);
GtkCssValue *_gtk_theming_engine_peek_property (GtkThemingEngine *engine,
- const char *property_name);
+ guint property_id);
double _gtk_theming_engine_get_number (GtkThemingEngine *engine,
- const char *property_name,
+ guint property_id,
double one_hundred_percent);
void _gtk_theming_engine_set_context (GtkThemingEngine *engine,
GtkStyleContext *context);